package step2;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.net.InetAddress;
import java.net.Socket;
import java.util.Scanner;

public class Client {

    public static void main(String[] args) throws Exception {
        Server server = new Server();
        server.start();
        Scanner sc = new Scanner(System.in);

        //创建客户端Socket(s)，指定服务器端IP地址和端口号
        /********** Begin **********/
        Socket s = new Socket("127.0.0.1",8000);

        /**********  end  **********/
        DataOutputStream dos = new DataOutputStream(s.getOutputStream());
        DataInputStream dis = new DataInputStream(s.getInputStream());
        System.out.println(dis.readUTF());
        String name = sc.next();
        dos.writeUTF(name);
        System.out.println(dis.readUTF());
        s.close();
    }
}